package com.aeon.annotation.time;

import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic;


@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedAnnotationTypes("com.aeon.annotation.time.StartCapture")
public class TimeAnnotationProcessor extends AbstractProcessor {

	@Override
	public boolean process(Set<? extends TypeElement> annotations,
			RoundEnvironment roundEnv) {

		for (Element elem : roundEnv.getElementsAnnotatedWith(StartCapture.class)) {
			StartCapture complexity = elem.getAnnotation(StartCapture.class);
	        String message = "annotation found in " + elem.getSimpleName()
	                       + " with complexity " + complexity.value();
	        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, message);
	    }
		
		return true;
	}

}
